package com.zlp.dto;

import java.math.BigDecimal;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/** 
 * 缓存添加进度条
 * @date: 2021/3/17 17:39
 * @return:  
 */
public class CacheUpload {

    static Map<String, UploadVO> progressMaps = new ConcurrentHashMap<>(128);

    private CacheUpload(){}

    /**
     * 获取上传进度条
     * @param uploadNo
     * @date: 2021/3/17 17:40
     * @return: void
     */
    public static UploadVO getProgressBar(String uploadNo) {
        UploadVO uploadVO = progressMaps.get(uploadNo);
        return uploadVO;
    }

    /**
     * 添加进度条
     * @param uploadNo
     * @date: 2021/3/17 17:40
     * @return: void
     */
    public static UploadVO putProgressBar(String uploadNo, BigDecimal progressBar) {
        UploadVO uploadVO = new UploadVO(uploadNo,progressBar);
        progressMaps.put(uploadNo,uploadVO);
        return uploadVO;
    }

    /**
     * 删除缓存
     * @param uploadNo
     * @date: 2021/3/17 17:40
     * @return: void
     */
    public static void removeProgressBar(String uploadNo) {
       
        progressMaps.remove(uploadNo);
    }

}
